﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Portal.Logic;
using System.Collections;
using Portal.Common.Entity;
using Common.Utils;
using Portal.Common.Interface;
using Common.Service;
using Common.Configuration;
using OC.Common.Entity;
using Common.BasePages;

namespace Portal
{
    public partial class IndexDemo : BasePage
    {
        private ITask _ITask;
        public ITask ITask 
        {
            get 
            {
                if (_ITask == null)
                {
                    _ITask = ServiceContainer.GetService<ITask>();
                }
                return _ITask;
            }
        }
        private ITaskCompleted _ITaskCompleted;
        public ITaskCompleted ITaskCompleted 
        {
            get 
            {
                if (_ITaskCompleted == null) 
                {
                    _ITaskCompleted = ServiceContainer.GetService<ITaskCompleted>();
                }
                return _ITaskCompleted;
            }
        }
        private IInboxRead _IInboxRead;
        public IInboxRead IInboxRead 
        {
            get 
            {
                if (_IInboxRead == null)
                {
                    _IInboxRead = ServiceContainer.GetService<IInboxRead>();
                }
                return _IInboxRead;
            }
        }
        private UserEntity _User;
        public UserEntity User 
        {
            get 
            {
                if (_User == null) 
                {
                    _User = UserInfo as UserEntity;
                }
                return _User;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {

                rptTask.DataSource = ITaskCompleted.GetList((ConfigurationManager.AppSettings["DomainName"] + "/" + User.AD_ACCOUNT.Trim()).ToUpper());
                rptTask.DataBind();

                rptReadedTask.DataSource = IInboxRead.GetList((ConfigurationManager.AppSettings["DomainName"] + "/" + User.AD_ACCOUNT.Trim()).ToUpper(), 1);
                rptReadedTask.DataBind();

                rptWellReadTask.DataSource = IInboxRead.GetList((ConfigurationManager.AppSettings["DomainName"] + "/" + User.AD_ACCOUNT.Trim()).ToUpper(), 2);
                rptWellReadTask.DataBind();

                rptWellTask.DataSource = ITask.Get((ConfigurationManager.AppSettings["DomainName"] + "/" + User.AD_ACCOUNT.Trim()).ToUpper());
                rptWellTask.DataBind();
            }
        }

    }
}